﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

    <title>淘菜菜物流履约培训——抽奖</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400"/>
    <!-- Google web font "Open Sans" -->
    <link rel="stylesheet" href="assets/train/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="assets/train/css/bootstrap.min.css"/>

    <link rel="stylesheet" href="assets/train/css/demo.css"/>
    <link rel="stylesheet" href="assets/train/css/templatemo-style.css"/>

    <script type="text/javascript" src="assets/train/js/modernizr.custom.86080.js"></script>

</head>

<body>

<div id="particles-js"></div>

<ul class="cb-slideshow">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

<div class="container-fluid">
    <div class="row cb-slideshow-text-container ">
        <div class="tm-content col-xl-6 col-sm-8 col-xs-8 ml-auto section">
            <header class="mb-5"><h1>签到人员</h1></header>
            <div id="signUserNames">
            </div>

            <form>
                <div class="row form-section">
                    <div class="col-md-5 col-sm-5 col-xs-5">
                        <button type="button" onclick="luck()" class="tm-btn-subscribe">开始抽奖</button>
                    </div>

                </div>
            </form>

        </div>
    </div>
</div>
<style>
</style>
</body>

<script type="text/javascript" src="assets/train/js/particles.js"></script>
<script type="text/javascript" src="assets/train/js/app.js"></script>
<script type="text/javascript" src="assets/js/jquery-1.12.4.min.js"></script>

<script>
    /*<![CDATA[*/
    $(document).ready(function() {
        loadTrainUser();
    });


    var maxSize;
    function loadTrainUser() {
        $.post("/api/train/searchSign.do",
            { //需要传入后代的数据
            },
            function (message) {
                var result = message;
                var signUserNamesHtml ="";
                for (var i in result.trainUsers) {
                    signUserNamesHtml += i+":" + result.trainUsers[i].username+"&nbsp;&nbsp;&nbsp;&nbsp;";
                    if(i !=0 && i%5 == 0){
                        signUserNamesHtml +="<br/>";
                    }
                    maxSize = i;
                }
                $("#signUserNames").html(signUserNamesHtml);

            }
        );
        // 必须返回false，否则表单会自己再做一次提交操作，并且页面跳转
        return false;
    }

    function luck() {
        alert("获取[0-" + maxSize + "]的随机数");
        alert(Math.floor(Math.random() * Math.floor(parseInt(maxSize) + 1)));
    }

    /*]]>*/
</script>
</html>